/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.com.apresentacao.pedagogico;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import src.com.apresentacao.infraEstrutura.WUnidade;
import src.com.apresentacao.midiateca.JFEmprestimoMaterial;
import src.com.apresentacao.midiateca.WMaterialDidatico;
import src.com.apresentacao.pedagogico.CadastroNivelCurso;
import src.com.apresentacao.pedagogico.CadastroTurma;

/**
 *
 * @author Camila Santos
 */
public class WHome extends javax.swing.JFrame {

    /**
     * Creates new form WHome
     */
    public WHome() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jInternalFrame1 = new javax.swing.JInternalFrame();
        jLabel1 = new javax.swing.JLabel();
        txtUsuario = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtSenha = new javax.swing.JPasswordField();
        jLabel3 = new javax.swing.JLabel();
        btEntrar = new javax.swing.JButton();
        menuInicial = new javax.swing.JMenuBar();
        mPessoa = new javax.swing.JMenu();
        mAluno = new javax.swing.JMenuItem();
        mProfessor = new javax.swing.JMenuItem();
        mFuncionario = new javax.swing.JMenuItem();
        mAcademico = new javax.swing.JMenu();
        mMatricula = new javax.swing.JMenuItem();
        mTurma = new javax.swing.JMenuItem();
        mNivel = new javax.swing.JMenuItem();
        mIdioma = new javax.swing.JMenuItem();
        mAgendamento = new javax.swing.JMenu();
        mTesteNivelamento = new javax.swing.JMenuItem();
        mAulaDemonstrativa = new javax.swing.JMenuItem();
        jMMidiateca = new javax.swing.JMenu();
        jMMaterialDicatico = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMInfraestrutura = new javax.swing.JMenu();
        jMUnidade = new javax.swing.JMenuItem();
        mSair = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jInternalFrame1.setTitle("Inicio");
        jInternalFrame1.setVisible(true);

        jLabel1.setFont(new java.awt.Font("Century Schoolbook L", 1, 18)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Login");

        jLabel2.setText("Usuario:");

        jLabel3.setText("Senha:");

        btEntrar.setText("Entrar");
        btEntrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btEntrarMouseClicked(evt);
            }
        });

        mPessoa.setText("Pessoas");

        mAluno.setText("Aluno");
        mAluno.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mAlunoMouseClicked(evt);
            }
        });
        mPessoa.add(mAluno);

        mProfessor.setText("Professor");
        mProfessor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mProfessorMouseClicked(evt);
            }
        });
        mPessoa.add(mProfessor);

        mFuncionario.setText("Funcionario");
        mFuncionario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mFuncionarioMouseClicked(evt);
            }
        });
        mFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mFuncionarioActionPerformed(evt);
            }
        });
        mPessoa.add(mFuncionario);

        menuInicial.add(mPessoa);

        mAcademico.setText("Academico");

        mMatricula.setText("Matricula");
        mMatricula.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mMatriculaMouseClicked(evt);
            }
        });
        mAcademico.add(mMatricula);

        mTurma.setText("Turma");
        mTurma.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mTurmaMouseClicked(evt);
            }
        });
        mAcademico.add(mTurma);

        mNivel.setText("Nivel de curso");
        mNivel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                mNivelMousePressed(evt);
            }
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mNivelMouseClicked(evt);
            }
        });
        mAcademico.add(mNivel);

        mIdioma.setText("Idioma");
        mIdioma.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mIdiomaMouseClicked(evt);
            }
        });
        mAcademico.add(mIdioma);

        menuInicial.add(mAcademico);

        mAgendamento.setText("Agendamento");

        mTesteNivelamento.setText("Teste de nivelamento");
        mTesteNivelamento.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mTesteNivelamentoMouseClicked(evt);
            }
        });
        mAgendamento.add(mTesteNivelamento);

        mAulaDemonstrativa.setText("Aula demonstrativa");
        mAulaDemonstrativa.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                mAulaDemonstrativaMousePressed(evt);
            }
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mAulaDemonstrativaMouseClicked(evt);
            }
        });
        mAgendamento.add(mAulaDemonstrativa);

        menuInicial.add(mAgendamento);

        jMMidiateca.setText("Midiateca");

        jMMaterialDicatico.setText("Cadastrar Material Didático");
        jMMaterialDicatico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMMaterialDicaticoActionPerformed(evt);
            }
        });
        jMMidiateca.add(jMMaterialDicatico);

        jMenuItem1.setText("Emprestar");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMMidiateca.add(jMenuItem1);

        menuInicial.add(jMMidiateca);

        jMInfraestrutura.setText("Infraestrutura");

        jMUnidade.setText("Unidade");
        jMUnidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMUnidadeActionPerformed(evt);
            }
        });
        jMInfraestrutura.add(jMUnidade);

        menuInicial.add(jMInfraestrutura);

        mSair.setText("Sair");
        mSair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mSairMouseClicked(evt);
            }
        });
        menuInicial.add(mSair);

        jInternalFrame1.setJMenuBar(menuInicial);

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jInternalFrame1Layout.createSequentialGroup()
                        .addGap(52, 52, 52)
                        .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                                .addGap(163, 163, 163)
                                .addComponent(jLabel1))
                            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                                .addGap(61, 61, 61)
                                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3))
                                .addGap(39, 39, 39)
                                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jInternalFrame1Layout.createSequentialGroup()
                        .addGap(350, 350, 350)
                        .addComponent(btEntrar)))
                .addContainerGap(103, Short.MAX_VALUE))
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
                .addContainerGap(35, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(26, 26, 26)
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(41, 41, 41)
                .addComponent(btEntrar)
                .addGap(58, 58, 58))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jInternalFrame1, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jInternalFrame1, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btEntrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btEntrarMouseClicked
        // TODO add your handling code here:
        String lsUsuario = txtUsuario.getText();
        String lsSenha = txtSenha.getText();

        System.out.print("Usuario: " + lsUsuario.toString() + " - Senha: " + lsSenha.toString());

        //se login efetuado, habilita menu
        mAluno.setEnabled(true);
        mProfessor.setEnabled(true);
        mFuncionario.setEnabled(true);
        mIdioma.setEnabled(true);
        mMatricula.setEnabled(true);
        mNivel.setEnabled(true);
        mTurma.setEnabled(true);
        mTesteNivelamento.setEnabled(true);
        mAulaDemonstrativa.setEnabled(true);
    }//GEN-LAST:event_btEntrarMouseClicked

    private void mAlunoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mAlunoMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mAlunoMouseClicked

    private void mProfessorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mProfessorMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mProfessorMouseClicked

    private void mFuncionarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mFuncionarioMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mFuncionarioMouseClicked

    private void mMatriculaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mMatriculaMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mMatriculaMouseClicked

    private void mTurmaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mTurmaMouseClicked
        // TODO add your handling code here:
        //new WHome().setVisible(true);
    }//GEN-LAST:event_mTurmaMouseClicked

    private void mNivelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mNivelMouseClicked
        try {

            new CadastroTurma().setVisible(true);//GEN-LAST:event_mNivelMouseClicked
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }

    private void mIdiomaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mIdiomaMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mIdiomaMouseClicked

    private void mTesteNivelamentoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mTesteNivelamentoMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_mTesteNivelamentoMouseClicked

    private void mAulaDemonstrativaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mAulaDemonstrativaMouseClicked
        System.err.println("opaaaaaaaaaaaaaaaaaaaS");        // TODO add your handling code here:
    }//GEN-LAST:event_mAulaDemonstrativaMouseClicked

    private void mSairMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mSairMouseClicked
        // TODO add your handling code here:
        //se sair do login, desabilita menu
        mAgendamento.setEnabled(false);
        mAluno.setEnabled(false);
        mProfessor.setEnabled(false);
        mFuncionario.setEnabled(false);
        mIdioma.setEnabled(false);
        mMatricula.setEnabled(false);
        mNivel.setEnabled(false);
        mTurma.setEnabled(false);
        mTesteNivelamento.setEnabled(false);
        mAulaDemonstrativa.setEnabled(false);
    }//GEN-LAST:event_mSairMouseClicked

    private void mAulaDemonstrativaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mAulaDemonstrativaMousePressed
        System.err.println("opaaaaaaaaaaaaaaaaaaa1111");        // TODO add your handling code here:
    }//GEN-LAST:event_mAulaDemonstrativaMousePressed

    private void mNivelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mNivelMousePressed

        try {
            CadastroNivelCurso b;
            b = new CadastroNivelCurso();
            b.setVisible(true);
            System.out.println("aqui");
        } catch (SQLException ex) {
            Logger.getLogger(WHome.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_mNivelMousePressed

    private void jMMaterialDicaticoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMMaterialDicaticoActionPerformed
        // TODO add your handling code here:
        WMaterialDidatico wMaterialDidatico = new WMaterialDidatico();
        wMaterialDidatico.setVisible(true);
    }//GEN-LAST:event_jMMaterialDicaticoActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        JFEmprestimoMaterial jFEmprestimoMaterial;
        try {
            jFEmprestimoMaterial = new JFEmprestimoMaterial();
            jFEmprestimoMaterial.setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(WHome.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMUnidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMUnidadeActionPerformed
        // TODO add your handling code here:
        WUnidade wUnidade = new WUnidade();
        wUnidade.setVisible(true);
    }//GEN-LAST:event_jMUnidadeActionPerformed

    private void mFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mFuncionarioActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            JFCadastroFuncionario jFCadastroFuncionario = new JFCadastroFuncionario();
            jFCadastroFuncionario.setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(WHome.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_mFuncionarioActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(WHome.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(WHome.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(WHome.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(WHome.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new WHome().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btEntrar;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMInfraestrutura;
    private javax.swing.JMenuItem jMMaterialDicatico;
    private javax.swing.JMenu jMMidiateca;
    private javax.swing.JMenuItem jMUnidade;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenu mAcademico;
    private javax.swing.JMenu mAgendamento;
    private javax.swing.JMenuItem mAluno;
    private javax.swing.JMenuItem mAulaDemonstrativa;
    private javax.swing.JMenuItem mFuncionario;
    private javax.swing.JMenuItem mIdioma;
    private javax.swing.JMenuItem mMatricula;
    private javax.swing.JMenuItem mNivel;
    private javax.swing.JMenu mPessoa;
    private javax.swing.JMenuItem mProfessor;
    private javax.swing.JMenu mSair;
    private javax.swing.JMenuItem mTesteNivelamento;
    private javax.swing.JMenuItem mTurma;
    private javax.swing.JMenuBar menuInicial;
    private javax.swing.JPasswordField txtSenha;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
}
